import java.util.Calendar;

//
// Store all of the data for a particular satellite 
// in this case
//

// Only create a new class when a satelite is observed for the first time
public class SatelliteData {

    private double[][] satelliteData;
    private int i;

    //
    // G = GPS, R = GLONASS, E = Galilleo, Q = QZSS, S = SBAS
    // P = Pseudolite
    //
    private String constellation;
    private int prn;
    // Number of diferent Observations which will be stored for this satellite
    private int numObsTypes;

    // Total number of epochs in the RINEX file being parsed
    private int numEpochs;
    private long[] epoch; 

    SatelliteData (int PRN, String Constellation, int nE, int numObsTypes) {
        i = 0;
        prn = PRN;
        constellation = Constellation;
        numObsTypes   = numObsTypes;
        numEpochs     = nE;
        satelliteData = new double[numEpochs][numObsTypes];
        epoch         = new long[numEpochs];
        //System.out.println("New Object PRN: "+prn+" Constell: "+constellation);
    }

    public void addData( double data, int index ) {
        //System.out.println("Sat :"+prn+": Adding data :"+data+": Index :"+index+": Epoch :"+i);
        satelliteData[i][index] = data;
    }

    public void setTime( long timeInMilliS ) {
        epoch[i] = timeInMilliS;
    }

    public long getTime( int i ) {
        return epoch[i];
    }
 
    public int incEpoch() {
        return i++;
    }

    public int getPRN() {
        return prn;
    }
  
    public String getConstell() {
        return constellation;
    }

    public int getNumEpochs() {
        return numEpochs;
    }

    public double getP1( int epoch ) {
        double P1;
        P1 = satelliteData[epoch][2];
        return P1;
    }
    
    public void dumpObs( int index ) {
        for(int j = 0; j < numEpochs; j++) {
            System.out.println(j+" :"+satelliteData[j][index]);
        }
    }
}
